Skip to content

fix(clan): migrate clan machine path off removed clanModules (#159) - #3684

Merged
dezren39 merged 1 commit into
mainfrom
queue/2943-159-clanmodules
Nov 2, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/2943-159-clanmodules

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Fixes #159.

nixosConfigurations.user failed to evaluate at main: attribute 'clanModules' missing at modules/disko.nix:12. The locked clan-core rev (8b9fd720) exports no clanModules output at all — the old modules were replaced by clanServices. Reproduced on laptop at main 9df0b20c3 before this change.

What changed

  • modules/disko.nix — standalone static disko configuration per the upstream disk-id migration guide. The dynamic clan.core.vars.generators.disk-id suffix is replaced with the machine's generated diskId, cross-checked against vars/per-machine/user/disk-id/diskId/value (822c2b3a…59a, matches the 2026-10-12 audit on Root flake check fails on nixosConfigurations due to missing clan-core.clanModules #159 — not invented). The device stays in machines/user/configuration.nix (module merge, unchanged semantics).
  • modules/shared.nix — the four dead imports and the removed clan.user-password option are gone. Also programs.gvfs → services.gvfs: that option was renamed upstream and blocked evaluation of this same file once the import error was fixed.
  • lib/default.nix (make-clan) — the services now live where clan-core at this rev requires them: inventory.instances. At the locked rev, sshd/users are _class = "clan.service" modules — they cannot be imported into a NixOS configuration, so the packet's shared.nix mechanism is implemented via inventory instead:
    • sshd (server role, all machines). CA-signed host certificates disabled: the old sshd module only generated host keys, and this repo has no shared openssh-ca vars — enabling certs made eval throw for the missing var.
    • user-root / user-user (users service) — generate the root and user passwords (were root-password / user-password). Their vars don't exist in the store yet; they are created by clan vars generate user at deploy time (same status as before: the old generators also had no vars in the repo).
    • state-version needs no instance: clanCore enables clan.core.settings.state-version by default, and the existing var yields 25.05.
    • zerotier — see below.
  • machines/user/configuration.nix — removed clan.core.networking.zerotier.controller.enable (the direct option was removed upstream and threw on evaluation). The machine is now controller + peer of the zerotier inventory instance. This file's scope in the packet was "import adjustments only", but the removed option made the whole machine path unevaluable; the inventory instance is the upstream-prescribed replacement (zerotier migration guide).
  • vars/shared/zerotier-network-zerotier/network-id/value — new public var seeded with the machine's existing network ID from machines/user/facts/zerotier-network-id (c5e451b2d6c22070), value-preserving as the migration guide prescribes. The zerotier identity var does not exist in the repo (only legacy facts) and is generated by clan vars generate at deploy time; the machine is its own controller, so it can accept itself after regeneration.

Verification (laptop, this branch)

  • nix eval .#nixosConfigurations.user.config.system.build.toplevel.drvPath — evaluates cleanly (failed at modules/disko.nix:12 on main).
  • Semantic spot-check of the evaluated config: services.openssh.enable = true, system.stateVersion = "25.05", disko.devices.disk.main.name = "main-822c2b3a90814675aa45e433aa1fe59a", device unchanged, root and user hashedPasswordFile set by the users service, services.zerotierone.enable = true.
  • grep clanModules modules/*.nix — clean.
  • nixfmt --check on all touched files — clean.

Queue task 2943 (repo-health-code-pilot), Lane D.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

clan-core at the locked rev (8b9fd720) exports no clanModules output, so evaluating nixosConfigurations.user failed with "attribute clanModules missing" at modules/disko.nix:12.

- modules/disko.nix: standalone static disko config per the upstream disk-id migration guide; disk name keeps the machine generated diskId (cross-checked against vars/per-machine/user/disk-id/diskId/value). Device stays in machines/user/configuration.nix. - modules/shared.nix: drop the dead sshd/root-password/user-password/state-version imports and the clan.user-password option. sshd and password generation are now clanServices inventory instances; state-version is enabled by clanCore defaults. Also move programs.gvfs -> services.gvfs (option renamed upstream; it blocked evaluation of the same file). - lib/default.nix (make-clan): inventory.instances for sshd (CA certificates disabled - the old module only generated host keys and this repo has no shared openssh-ca vars), users instances for root and user passwords, and the zerotier network. - machines/user/configuration.nix: remove clan.core.networking.zerotier.controller.enable (direct option removed upstream); the machine is controller+peer of the zerotier inventory instance instead. - vars/shared/zerotier-network-zerotier/network-id/value: seed the public network-id var with the machines existing network id from machines/user/facts/zerotier-network-id (value-preserving; the zerotier identity var is generated at deploy time by clan vars generate).
@dezren39
dezren39 requested a review from a team as a code owner November 1, 2026 12:48
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 45 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c42731bb-8731-483f-b0b2-10e28a733085
Commits

Reviewing files that changed from the base of the PR and between 9be9c22 and 6306477.

Files selected for processing: 5
  • lib/default.nix
  • machines/user/configuration.nix
  • modules/disko.nix
  • modules/shared.nix
  • vars/shared/zerotier-network-zerotier/network-id/value
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T12:51:59.972351Z 6306477 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6306477842

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -0,0 +1 @@
c5e451b2d6c22070 No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Migrate the controller identity together with its network ID

On deployment, this preserves the old network ID without migrating the controller identity from sops/secrets/user-zerotier-identity-secret/secret into the new vars store. A newly generated identity cannot control this network: ZeroTier's protocol documentation specifies that the first 10 hex digits of a network ID identify its controller, so this network requires the identity c5e451b2d6. Being both controller and peer does not allow a different identity to authorize itself on that network. Import the existing controller identity before generating/deploying the new service; preserving identities alongside network IDs is also required by the Clan migration guide.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accepted — verified, not merging past this.

Verified on the PR head (6306477): vars/per-machine/user/ contains only disk-id, openssh, and state-version — there is no zerotier identity in the vars store, while the controller identity exists only at sops/secrets/user-zerotier-identity-secret. The PR preserves the network ID (vars/shared/zerotier-network-zerotier/network-id/value) without importing that identity, so a deploy-time vars generation would mint a new controller identity that cannot authorize peers on this network (network-ID prefix = controller identity, per the linked ZeroTier doc and the Clan zerotier migration guide).

Disposition: merge of PR #3684 is blocked on this finding. Fix path (queue task 2943, parked with this as the resume condition): import the existing controller identity from the sops secret into the zerotier service's vars before any deploy, per the Clan migration guide — a deliberate secrets-handling step, not done in a shift tail. Alternative if the import proves impractical: split the zerotier instance out of this PR and re-verify eval. The rest of the PR is verified: nix eval .#nixosConfigurations.user.config.system.build.toplevel.drvPath passes at head and no clanModules refs remain in modules/*.nix.

@dezren39
dezren39 merged commit a47cc0f into main Nov 2, 2026
1 check passed
@dezren39
dezren39 deleted the queue/2943-159-clanmodules branch November 2, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Root flake check fails on nixosConfigurations due to missing clan-core.clanModules

1 participant